package com.hunter.test;


import java.awt.*;

/**
 * @Project:iwms
 * @Description: 获取屏幕坐标
 * @Author: Mr.Hunter
 * @Date:2022/6/7/8:43
 */
public class MousePointer {


    private void getPointInfo() {

        while (true) {
            PointerInfo pinfo = MouseInfo.getPointerInfo();
            int mx = pinfo.getLocation().x;
            int my = pinfo.getLocation().y;
            System.out.println("x:" + mx + ",y:" + my);


            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                System.out.println(e.getMessage());
            }
        }
    }

    public static void main(String[] args) {
        MousePointer test = new MousePointer();
        test.getPointInfo();
    }
}